import Vue from 'vue'
import VueRouter from 'vue-router'

import Footer from '@/components/footer.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'home',
    meta: { index: 0 },
    components: {
      default: () => import('@/views/home/index'),
      footer: Footer
    }
  },
  {
    path: '/quanquan',
    name: 'quanquan',
    meta: { index: 1 },
    components: {
      default: () => import('@/views/quanquan/index'),
      footer: Footer
    }
  },
  {
    path: '/quanquan/person',
    name: 'person',
    meta: { index: 1 },
    component: () => import('@/views/quanquan/person.vue')
  },
  {
    path: '/quanquan/editmine',
    name: 'editmine',
    component: () => import('@/views/quanquan/editmine.vue')
  },
  {
    path: '/quanquan/mine',
    name: 'mine',
    component: () => import('@/views/quanquan/mine.vue')
  },
  {
    path: '/quanquan/edit2',
    name: 'edit2',
    component: () => import('@/views/quanquan/edit2.vue')
  },
  {
    path: '/peipei',
    name: 'peipei',
    meta: { index: 1 },
    components: {
      default: () => import('@/views/peipei/index'),
      footer: Footer
    }
  },
  {
    path: '/liaoliao',
    name: 'liaoliao',
    meta: { index: 1 },
    components: {
      default: () => import('@/views/liaoliao/index'),
      footer: Footer
    },
    children: [
      {
        path: 'tongzhi',
        name: 'tongzhi',
        components:() => import('@/views/liaoliao/tongzhi'),
      }
    ]
  },
  {
    path: '/user',
    name: 'user',
    meta: { index: 1 },
    components: {
      default: () => import('@/views/user/index'),
      footer: Footer
    }
  },
  {
    path: '/login',
    name: 'login',
    meta: { index: 2 },
    components: {
      default: () => import('@/views/login/index')
    }
  },
  {
    path: '/register',
    name: 'register',
    meta: { index: 2 },
    component: () => import('@/views/register/index.vue')
  },
  {
    path: '/talk',
    name: 'talk',
    meta: { index: 3 },
    components: {
      default: () => import('@/views/talk/index.vue')
    }
  },
  {
    path: '/phone',
    name: 'phone',
    meta: { index: 3 },
    components: {
      default: () => import('@/views/phone/index.vue')
    }

  },
  {
    path: '*',
    name: 'notfound',
    component: () => import('@/views/notfound/index.vue')
  }
]
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
